package com.yjd.comm.sms.convert;

import java.util.List;

import com.yjd.comm.sms.enums.SmsStatusEnum;
import com.yjd.comm.sms.model.SmsContentModel;
import com.yjd.comm.util.DateUtil;

/**
 * <b>description</b>：还款报表数据转换器 <br>
 * <b>time</b>：2014-10-16上午11:45:11 <br>
 * <b>author</b>： ready likun_557@163.com
 */
public class SmsConvert {
	public static SmsContentModel convert(SmsContentModel model)
			throws Exception {
		if (model != null) {
			SmsStatusEnum status = SmsStatusEnum
					.getSmsStatus(model.getStatus());
			model.getStrMap().put("status",
					status != null ? status.getDescription() : "");
			model.getStrMap().put(
					"createTime",
					DateUtil.timestampToDateString(model.getCreateTime(),
							DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
			model.getStrMap().put(
					"sendTime",
					DateUtil.timestampToDateString(model.getSendTime(),
							DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
			model.getStrMap().put(
					"actualSendTime",
					DateUtil.timestampToDateString(model.getActualSendTime(),
							DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
		}
		return model;
	}

	public static List<SmsContentModel> convert(List<SmsContentModel> models)
			throws Exception {
		if (models == null || models.size() == 0) {
			return models;
		}
		for (SmsContentModel model : models) {
			convert(model);
		}
		return models;
	}

}
